package com.vic.controller.global;

import com.vic.entity.vo.ResponseVO;;

import com.vic.enums.ResponseCodeEnum;;

/**
 * @Author: Vic Ly
 */
public class BaseController<T> {
    protected static final String STATUS_SUCCESS = "SUCCESS";
    protected static final String STATUS_ERROR = "ERROR";

    // 返回查询操作结果
    protected <T> ResponseVO getSuccessResponseVO(T t){
        ResponseVO<T> responseVO = new ResponseVO<T>();
        responseVO.setStatus(STATUS_SUCCESS);
        responseVO.setCode(ResponseCodeEnum.code_200.getCode());
        responseVO.setInfo(ResponseCodeEnum.code_200.getMsg());
        responseVO.setData(t);
        return responseVO;
    }
    // 增删改什么都不返回
    protected <T> ResponseVO getSuccessResponseVO(){
        ResponseVO responseVO = new ResponseVO();
        responseVO.setStatus(STATUS_SUCCESS);
        responseVO.setCode(ResponseCodeEnum.code_200.getCode());
        responseVO.setInfo(ResponseCodeEnum.code_200.getMsg());
        return responseVO;
    }
}
